ShowTable of Contents
Overview
Component properties allow developers to create code that at compile time has specific function but accepts flexible input at runtime. For example, a developer can create a component that uses a predefined component property to update the title tab's text within a composite application. Composite application deployers and end users then have the flexibility to change application behavior simply by modifying the property during assembly.
Create the View
Begin by creating a simple view. The ViewPart code should read the com.ibm.rcp.title component property and set the ViewPart's name accordingly. The TopologyHandler and ComponentData types may be found in the com.ibm.pvc.sharedbundle plugin; be sure to add this to your required plugins list on the dependencies tab.
public void createPartControl(Composite parent) {
TopologyHandler handler = TopologyHandlerServiceFactory.getService();
if (handler == null) return;
String pref[] = null;
String id = getViewSite( ).getSecondaryId( );
id = id.replace('.', '_');
ComponentData cd = handler.getComponentData( id);
pref = cd.getPreference("com.ibm.rcp.title");
setPartName(pref[0]);
}
Creating the Composite Application
Create a new composite application using the File -> Application -> New Composite Application menu item. Add the view to a composite application by using the Add Component -> Locally Installed Components menu. If you do not see the view available in the component library, ensure the allowMuliple property is true in the view's extension.
Updating the Component Properties
Edit the component's properties to first update the title (available on the Component Settings tab). The title entered here is provided to components as the property com.ibm.rcp.title. Additionally, update the Advanced tab's property com.ibm.rcp.showTitle to true. This will show the tab such that we can see the title.
Save the composite application to view the updated title.